class List
{
    var arr, len;
    method List(length)
    {
        this.arr = array(length);
    }
    method List()
    {
        this.arr = array();
    }
    method Add(item)
    {
        array_push(this.arr, item);
    }
    method Get(index)
    {
        return this.arr[index];
    }
    method Set(index, val)
    {
        this.arr[index] = val;
    }
    method Length()
    {
        return array_size(this.arr);
    }
    method Print()
    {
        var i;
        var l = this.Length();
        print("[");
        for (i = 0; i < l; i = i + 1)
        {
            print(this.arr[i]);
            if (i != l - 1)
            {
                print(", ");
            }
        }
        println("]");
    }
}

function main(argc, argv)
{
    var list = new List();
    list.Add(1);
    list.Add(2);
    list.Add(3);
    list.Add(4);
    list.Add(5);
    list.Add(6);
    list.Print();
    var i, n = 10;
    var list2 = new List(n);
    for (i = 0; i < n; i = i + 1)
    {
        list2.Set(i, n - i);
    }
    list2.Print();
    return 0;
}
